package com.cmj.service.impl;

import com.cmj.Utils.SecurityUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 这是注释
 */
@Service("ps")
public class PermissionsService {
    public boolean hasPermissions(String permission){
        //超级管理员直接确认有权限
        if (SecurityUtils.isAdmin()){
            return true;
        }

        //判断该用户是否包括此权限
        List<String> permissions = SecurityUtils.getLoginUser().getPermissions();
        return permissions.contains(permission);
    }
}
